<?php
namespace app\serveruser\validate;
use \app\manage\validate\BaseValidate;
/**
 * 角色组管理的验证类
 * @author adv30 <adv30@126.com> 2017年6月5日11:32:33
 */
class RoleGroup extends BaseValidate
{
    // 是否使用true基础的验证规则
    // protected $useBaseRules = false;
    protected $rule = [
        'id' => ['integer', 'gt' => '0'],
        'name' => ['length' => '2,20'],
        'role_ids' => ['length' => '1,126'],
        'group_ids' => ['regex' => '^(\d)+(,\d+)*'],
    ];
    protected $message = [
        'name.length' => '名称的长度应在2-20个字符',
    ];
    protected $scene = [
        'add' => ['name' => ['require', 'length' => '2,20'], 'role_ids' => ['require', 'length' => '1,126']],
        'stop' => ['id', 'name'],
        'list' => ['page', 'list_rows'],
        'edit' => ['id', 'name', 'role_ids'],
        'roleGroupIdsToRoleIds' => ['group_ids']
    ];
}
